﻿using System;
using System.ServiceModel;
using Microsoft.ServiceBus;

namespace Server
{
    class Program
    {
        static void Main(String[] args)
        {
            var host = new ServiceHost(typeof (OperationExecutor));
            //host.AddServiceEndpoint
            //    (
            //        typeof (IOperationExecutor), 
            //        new NetTcpBinding(), 
            //        "net.tcp//localhost:9358/executor"
            //    );
            host.AddServiceEndpoint
                (
                    typeof(IOperationExecutor), 
                    new NetTcpRelayBinding(), 
                    ServiceBusEnvironment.CreateServiceUri("sb", "dotnetmarche", "executor")
                )
                .Behaviors.Add
                (
                    new TransportClientEndpointBehavior
                        {
                            TokenProvider = TokenProvider.CreateSharedSecretTokenProvider("OWNER", "SHARED KEY")
                        }
                );

            host.Open();

            Console.WriteLine("press a key to continue...");
            Console.ReadLine();
        }
    }
}
